#!/usr/bin/env python

env = Environment()
# env['JAVACCOMSTR'] = '$JAVAC $SOURCES' #'\033[F' #print_command
foo_classes = env.Java(target='foo.classes', source='foo/src/main')
env.Clean(foo_classes, 'foo.classes')
bar_env = env.Clone()
bar_env.Append(JAVACLASSPATH=["foo.classes"])
bar_classes = bar_env.Java(target='bar.classes', source='bar/src/main', JAVACLASSPATH=['foo.classes'])
env.Clean(bar_classes, 'bar.classes')
bar_env.Depends(bar_classes, foo_classes)
jar = env.Jar(target='bar.jar', source = [foo_classes, bar_classes])

foo_test_classes = env.Java(target='foo_test.classes', source='foo/src/test',
        JAVACLASSPATH=['foo.classes', '/usr/share/java/junit4.jar'])
env.Clean(foo_test_classes, 'foo_test.classes')

bar_test_env = env.Clone()
bar_test_env.Append(JAVACLASSPATH=['foo.classes', 'bar.classes', '/usr/share/java/junit4.jar'])
bar_test_classes = bar_test_env.Java(target='bar_test.classes', source='bar/src/test')
bar_test_env.Clean(bar_test_classes, 'bar_test.classes')

